<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Teamwork</title>

    <link rel=stylesheet href="__CDN__/assets/addons/workteam/gantt/platform.css" type="text/css">
    <link rel=stylesheet href="__CDN__/assets/addons/workteam/gantt/libs/jquery/dateField/jquery.dateField.css" type="text/css">

    <link rel=stylesheet href="__CDN__/assets/addons/workteam/gantt/gantt.css" type="text/css">
    <link rel=stylesheet href="__CDN__/assets/addons/workteam/gantt/ganttPrint.css" type="text/css" media="print">
    <link rel=stylesheet href="__CDN__/assets/addons/workteam/gantt/libs/jquery/valueSlider/mb.slider.css" type="text/css" media="print">





    <script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/jquery/jquery-ui.min.js"></script>

    <script src="__CDN__/assets/addons/workteam/gantt/libs/jquery/jquery.livequery.1.1.1.min.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/jquery/jquery.timers.js"></script>

    <script src="__CDN__/assets/addons/workteam/gantt/libs/utilities.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/forms.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/date.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/dialogs.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/layout.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/i18nJs.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/jquery/dateField/jquery.dateField.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/jquery/JST/jquery.JST.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/libs/jquery/valueSlider/jquery.mb.slider.js"></script>

    <script type="text/javascript" src="__CDN__/assets/addons/workteam/gantt/libs/jquery/svg/jquery.svg.min.js"></script>
    <script type="text/javascript" src="__CDN__/assets/addons/workteam/gantt/libs/jquery/svg/jquery.svgdom.1.8.js"></script>


    <script src="__CDN__/assets/addons/workteam/gantt/ganttUtilities.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/ganttTask.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/ganttDrawerSVG.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/ganttZoom.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/ganttGridEditor.js"></script>
    <script src="__CDN__/assets/addons/workteam/gantt/ganttMaster.js"></script>

</head>
<body style="background-color: #fff;">



<div id="workSpace" style="padding:0px; overflow-y:auto; overflow-x:hidden;border:1px solid #e5e5e5;position:relative;margin:0 5px">
</div>

<style>
    .resEdit {
        padding: 15px;
    }

    .resLine {
        width: 95%;
        padding: 3px;
        margin: 5px;
        border: 1px solid #d0d0d0;
    }

    body {
        overflow: hidden;
    }

    .ganttButtonBar h1{
        color: #000000;
        font-weight: bold;
        font-size: 28px;
        margin-left: 10px;
    }

</style>


<script type="text/javascript">

    var ge;
    $(function() {
        var canWrite=true; //this is the default for test purposes

        // here starts gantt initialization
        ge = new GanttMaster();
        ge.set100OnClose=true;

        ge.shrinkParent=true;

        ge.init($("#workSpace"));
        loadI18n(); //overwrite with localized ones

        //in order to force compute the best-fitting zoom level
        delete ge.gantt.zoom;

        var project=loadFromLocalStorage();

        if (!project.canWrite)
            $(".ganttButtonBar button.requireWrite").attr("disabled","true");

        ge.loadProject(project);
        ge.checkpoint(); //empty the undo stack

       // initializeHistoryManagement(ge.tasks[0].id);
    });



    function getDemoProject(){

        var tasklist = {:json_encode($tasklist)};
        ret= {"tasks":   tasklist, "selectedRow": 0, "deletedTaskIds": [],
            "resources": [
                {"id": "tmp_1", "name": "Resource 1"},
                {"id": "tmp_2", "name": "Resource 2"},
                {"id": "tmp_3", "name": "Resource 3"},
                {"id": "tmp_4", "name": "Resource 4"}
            ],
            "roles":       [
                {"id": "tmp_1", "name": "Project Manager"},
                {"id": "tmp_2", "name": "Worker"},
                {"id": "tmp_3", "name": "Stakeholder"},
                {"id": "tmp_4", "name": "Customer"}
            ], "canWrite":    false, "canDelete":false, "canWriteOnParent": false, canAdd:false}


        //actualize data
        var offset=new Date().getTime()-ret.tasks[0].start;
        for (var i=0;i<ret.tasks.length;i++) {
            // ret.tasks[i].start = ret.tasks[i].start + offset;
        }
        return ret;
    }



    function loadGanttFromServer(taskId, callback) {

        //this is a simulation: load data from the local storage if you have already played with the demo or a textarea with starting demo data
        var ret=loadFromLocalStorage();


        return ret;
    }



    function saveGanttOnServer() {

        var prj = ge.saveProject();

        download(JSON.stringify(prj, null, '\t'), "MyProject.json", "application/json");
    }



    function newProject(){
        clearGantt();
    }


    function clearGantt() {
        ge.reset();
    }


    function loadFromLocalStorage() {
        var ret;
        if (localStorage) {
            if (localStorage.getObject("teamworkGantDemo")) {
                ret = localStorage.getObject("teamworkGantDemo");
            }
        }

        //if not found create a new example task
        if (!ret || !ret.tasks || ret.tasks.length == 0){
            ret=getDemoProject();
        }
        return ret;
    }







</script>





<div id="gantEditorTemplates" style="display:none;">
    <div class="__template__" type="GANTBUTTONS">
        <!--
        <div class="ganttButtonBar noprint">
          <div class="buttons">
            <button onclick="$('#workSpace').trigger('expandAll.gantt');return false;" class="button textual icon " title="EXPAND_ALL"><span class="teamworkIcon">6</span></button>
            <button onclick="$('#workSpace').trigger('collapseAll.gantt'); return false;" class="button textual icon " title="COLLAPSE_ALL"><span class="teamworkIcon">5</span></button>

          <span class="ganttButtonSeparator"></span>
            <button onclick="$('#workSpace').trigger('zoomMinus.gantt'); return false;" class="button textual icon " title="zoom out"><span class="teamworkIcon">)</span></button>
            <button onclick="$('#workSpace').trigger('zoomPlus.gantt');return false;" class="button textual icon " title="zoom in"><span class="teamworkIcon">(</span></button>
          <span class="ganttButtonSeparator"></span>
            <button onclick="$('#workSpace').trigger('print.gantt');return false;" class="button textual icon " title="Print"><span class="teamworkIcon">p</span></button>
          <span class="ganttButtonSeparator"></span>
            <button onclick="ge.gantt.showCriticalPath=!ge.gantt.showCriticalPath; ge.redraw();return false;" class="button textual icon requireCanSeeCriticalPath" title="CRITICAL_PATH"><span class="teamworkIcon">&pound;</span></button>
          <span class="ganttButtonSeparator requireCanSeeCriticalPath"></span>
            <button onclick="ge.splitter.resize(.1);return false;" class="button textual icon" ><span class="teamworkIcon">F</span></button>
            <button onclick="ge.splitter.resize(50);return false;" class="button textual icon" ><span class="teamworkIcon">O</span></button>
            <button onclick="ge.splitter.resize(100);return false;" class="button textual icon"><span class="teamworkIcon">R</span></button>

            <button  class="button textual icon" onclick="addtask();" ><span class="teamworkIcon">&#x50;</span></button>

            &nbsp; &nbsp; &nbsp; &nbsp;
          </div>


        </div>
        -->
    </div>

    <div class="__template__" type="TASKSEDITHEAD"><!--
  <table class="gdfTable" cellspacing="0" cellpadding="0">
    <thead>
    <tr style="height:40px">
      <th class="gdfColHeader" style="width:35px; border-right: none"></th>
      <th class="gdfColHeader" style="width:35px; border-right: none"></th>
      <th class="gdfColHeader" style="width:25px;"></th>
      <th class="gdfColHeader gdfResizable" style="width:100px;">{:__("编号")}</th>
      <th class="gdfColHeader gdfResizable" style="width:300px;">{:__("任务名称")}</th>

      <th class="gdfColHeader gdfResizable" style="width:80px;">{:__("开始")}</th>

      <th class="gdfColHeader gdfResizable" style="width:80px;">{:__("结束")}</th>
      <th class="gdfColHeader gdfResizable" style="width:50px;">{:__("工时")}</th>
      <th class="gdfColHeader gdfResizable" style="width:20px;">{:__("进度")}%</th>
      <th class="gdfColHeader gdfResizable requireCanSeeDep" style="width:50px;">{:__("状态")}</th>
      <th class="gdfColHeader gdfResizable" style="text-align: left; padding-left: 10px;">{:__("负责人")}</th>
    </tr>
    </thead>
  </table>
  --></div>

    <div class="__template__" type="TASKROW"><!--
  <tr id="tid_(#=obj.id#)" taskId="(#=obj.id#)" class="taskEditRow (#=obj.isParent()?'isParent':''#) (#=obj.collapsed?'collapsed':''#)" level="(#=level#)">
    <th class="gdfCell edit" align="right" style="cursor:pointer;">
    	<span class="taskRowIndex">(#=obj.getRow()+1#)</span>
    	<span class="teamworkIcon" style="font-size:12px;" >e</span>
	</th>
	<th class="gdfCell addchild" onclick="addchild((#=obj.id#),'(#=obj.name#)')" style="cursor:pointer;">
    	(#=obj.status=='STATUS_SUSPENDED' || obj.status=='STATUS_ACTIVE' ? '<span class="teamworkIcon" style="font-size:12px;" >P</span>' : ''#)
	</th>
    <td class="gdfCell noClip" align="center"><div class="taskStatus cvcColorSquare" status="(#=obj.status#)"></div></td>
    <td class="gdfCell"><input type="text" name="code" value="(#=obj.code?obj.code:''#)" placeholder="code/short name"></td>
    <td class="gdfCell indentCell" style="padding-left:(#=obj.level*10+18#)px;">
      <div class="exp-controller" align="center"></div>
      <input type="text" name="name" value="(#=obj.name#)" placeholder="name">
    </td>

    <td class="gdfCell"><input type="text" name="start"  value="" class="date"></td>

    <td class="gdfCell"><input type="text" name="end" value="" class="date"></td>
    <td class="gdfCell"><input type="text" name="plan_hours" autocomplete="off" value="(#=obj.plan_hours#)"></td>
    <td class="gdfCell"><input type="text" name="progress" class="validated" entrytype="PERCENTILE" autocomplete="off" value="(#=obj.progress?obj.progress:''#)" (#=obj.progressByWorklog?"readOnly":""#)></td>
    <td class="gdfCell requireCanSeeDep">
    (#=obj.statusText#)
    <input type="text" name="depends" autocomplete="off" value="(#=obj.depends#)" (#=obj.hasExternalDep?"readonly":""#)>
    </td>
    <td class="gdfCell">(#=obj.admin.nickname#)</td>
  </tr>
  --></div>

    <div class="__template__" type="TASKEMPTYROW"><!--
  <tr class="taskEditRow emptyRow" >
    <th class="gdfCell" align="right"></th>
    <th class="gdfCell" align="right"></th>
    <td class="gdfCell noClip" align="center"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell requireCanSeeDep"></td>
    <td class="gdfCell"></td>
  </tr>
  --></div>

    <div class="__template__" type="TASKBAR"><!--
  <div class="taskBox taskBoxDiv" taskId="(#=obj.id#)" >
    <div class="layout (#=obj.hasExternalDep?'extDep':''#)">
      <div class="taskStatus" status="(#=obj.status#)"></div>
      <div class="taskProgress" style="width:(#=obj.progress>100?100:obj.progress#)%; background-color:(#=obj.progress>100?'red':'rgb(153,255,51);'#);"></div>
      <div class="milestone (#=obj.startIsMilestone?'active':''#)" ></div>

      <div class="taskLabel"></div>
      <div class="milestone end (#=obj.endIsMilestone?'active':''#)" ></div>
    </div>
  </div>
  --></div>


    <div class="__template__" type="CHANGE_STATUS"><!--
    <div class="taskStatusBox">
    <div class="taskStatus cvcColorSquare" status="STATUS_ACTIVE" title="Active"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_DONE" title="Completed"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_FAILED" title="Failed"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_SUSPENDED" title="Suspended"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_WAITING" title="Waiting" style="display: none;"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_UNDEFINED" title="Undefined"></div>
    </div>
  --></div>








    <div class="__template__" type="ASSIGNMENT_ROW"><!--
  <tr taskId="(#=obj.task.id#)" assId="(#=obj.assig.id#)" class="assigEditRow" >
    <td ><select name="resourceId"  class="formElements" (#=obj.assig.id.indexOf("tmp_")==0?"":"disabled"#) ></select></td>
    <td ><select type="select" name="roleId"  class="formElements"></select></td>
    <td ><input type="text" name="effort" value="(#=getMillisInHoursMinutes(obj.assig.effort)#)" size="5" class="formElements"></td>
    <td align="center"><span class="teamworkIcon delAssig del" style="cursor: pointer">d</span></td>
  </tr>
  --></div>



    <div class="__template__" type="RESOURCE_EDITOR"><!--
  <div class="resourceEditor" style="padding: 5px;">

    <h2>Project team</h2>
    <table  cellspacing="1" cellpadding="0" width="100%" id="resourcesTable">
      <tr>
        <th style="width:100px;">name</th>
        <th style="width:30px;" id="addResource"><span class="teamworkIcon" style="cursor: pointer">+</span></th>
      </tr>
    </table>

    <div style="text-align: right; padding-top: 20px"><button id="resSaveButton" class="button big">Save</button></div>
  </div>
  --></div>



    <div class="__template__" type="RESOURCE_ROW"><!--
  <tr resId="(#=obj.id#)" class="resRow" >
    <td ><input type="text" name="name" value="(#=obj.name#)" style="width:100%;" class="formElements"></td>
    <td align="center"><span class="teamworkIcon delRes del" style="cursor: pointer">d</span></td>
  </tr>
  --></div>


</div>
<script type="text/javascript">


    GridEditor.prototype.openFullEditor = function (task, editOnlyAssig){
        parent.Fast.api.open('{:url("/workteam/task/edit/ids/")}'+task.id,"任务编辑："+task.name,{callback: function () {
                window.location.reload();
            }});
    }
	function addchild(task_id, task_name){
		parent.Fast.api.open('{:url("/workteam/task/addchild/ids/")}'+task_id,"添加子任务："+task_name,{callback: function () {
                window.location.reload();
            }});

	}
    function addtask() {
        parent.Fast.api.open('{:url("/workteam/task/add/ids/")}'+{$row.id},"任务添加",{callback: function () {
                window.location.reload();
            }});
    }
    function loadI18n(){
        GanttMaster.messages = {
            "CANNOT_WRITE":"No permission to change the following task:",
            "CHANGE_OUT_OF_SCOPE":"Project update not possible as you lack rights for updating a parent project.",
            "START_IS_MILESTONE":"Start date is a milestone.",
            "END_IS_MILESTONE":"End date is a milestone.",
            "TASK_HAS_CONSTRAINTS":"Task has constraints.",
            "GANTT_ERROR_DEPENDS_ON_OPEN_TASK":"Error: there is a dependency on an open task.",
            "GANTT_ERROR_DESCENDANT_OF_CLOSED_TASK":"Error: due to a descendant of a closed task.",
            "TASK_HAS_EXTERNAL_DEPS":"This task has external dependencies.",
            "GANNT_ERROR_LOADING_DATA_TASK_REMOVED":"GANNT_ERROR_LOADING_DATA_TASK_REMOVED",
            "CIRCULAR_REFERENCE":"Circular reference.",
            "CANNOT_DEPENDS_ON_ANCESTORS":"Cannot depend on ancestors.",
            "INVALID_DATE_FORMAT":"The data inserted are invalid for the field format.",
            "GANTT_ERROR_LOADING_DATA_TASK_REMOVED":"An error has occurred while loading the data. A task has been trashed.",
            "CANNOT_CLOSE_TASK_IF_OPEN_ISSUE":"Cannot close a task with open issues",
            "TASK_MOVE_INCONSISTENT_LEVEL":"You cannot exchange tasks of different depth.",
            "CANNOT_MOVE_TASK":"CANNOT_MOVE_TASK",
            "PLEASE_SAVE_PROJECT":"PLEASE_SAVE_PROJECT",
            "GANTT_SEMESTER":"Semester",
            "GANTT_SEMESTER_SHORT":"s.",
            "GANTT_QUARTER":"Quarter",
            "GANTT_QUARTER_SHORT":"q.",
            "GANTT_WEEK":"Week",
            "GANTT_WEEK_SHORT":"w."
        };
    }







</script>




</body>
</html>